﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Visit_Record_Maitain.aspx.cs" MasterPageFile="~/MasterPage.master"
    Inherits="CallRoute_Visit_Record_Maitain" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <title>拜访历史</title>


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<script type="text/javascript">
    /*  
    将Date/String类型,解析为String类型.  
    传入String类型,则先解析为Date类型  
    不正确的Date,返回 ''  
    如果时间部分为0,则忽略,只返回日期部分.  
    */
    var y = '';
    var m = '';
    var d = '';
    function formatDate(date) {
       
  
       y = date.getFullYear();
   
       m = date.getMonth() + 1;
  
       d = date.getDate();
  
   var h = date.getHours();
   var M = date.getMinutes();
   var s = date.getSeconds();
   function formatNumber(value){
    return (value < 10 ? '0' : '') + value;
}

   return y+'-'+m+'-'+d+' '+ formatNumber(h)+':'+formatNumber(M)+':'+formatNumber(s);
  }

  $(function () {
      $('#<%=TxtStartDate.ClientID %>').datetimebox({
          currentText: '今天',
          closeText: '关闭',
          okText: '确定',
          disabled: false,
          required: true,
          missingMessage: '必填',
          formatter: formatDate
      }); 
  });
    $(function () {
        $('#<%=txtEndDate.ClientID %>').datetimebox({
            currentText: '今天',
            closeText: '关闭',
            okText: '确定',
            disabled: false,
            required: true,
            missingMessage: '必填',
            formatter: formatDate
            

        });
    });

    function checkDate() {
        Page_ClientValidate();
        var startDate = $('#<%=TxtStartDate.ClientID %>').datebox('getValue');
        var stopDate = $('#<%=txtEndDate.ClientID %>').datebox('getValue');
       
       
        
        if (startDate == '') {
            alert('请选择开始时间');
            return false;
        }
        if (stopDate == '') {
            alert('请选择结束时间');
            return false;
        }
        if (dateCompare(startDate, stopDate) == 1) {
            alert('结束日期不能小于开始日期');
            return false;
        }
        return true;

    }
    function dateCompare(date1, date2) {
        date1 = date1.replace(/\-/gi, "/");
        date2 = date2.replace(/\-/gi, "/");
        var time1 = new Date(date1).getTime();
        var time2 = new Date(date2).getTime();
        if (time1 > time2) {
            return 1;
        } else if (time1 == time2) {
            return 2;
        } else {
            return 3;
        }
    }
</script>
    <div>
        <table width="100%">
            <tr runat="server" id="trSearch">
                <td>
                    <table id="wsd_inputtable">
                        <tr>
                            <td class="tabletitle" colspan="6">
                                  <font color="red" size="2"><b><asp:Literal
                            ID="Literal4" runat="server" Text="<%$resources:language,lbl_Required %>"></asp:Literal>
                            </td>
                        </tr>
                        
                        <tr>
                            <td class="tablefield">
                                客户名称:</td>
                            <td nowrap="nowrap">
                                <asp:DropDownList ID="ddlCustomer" runat="server" Width="150">
                                    <asp:ListItem Value="">---所有---</asp:ListItem>
                                </asp:DropDownList>
                               <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="ddlCustomer"
                              runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
                            </td>
                            <td class="tablefield">
                                开始时间:</td>
                            <td nowrap="nowrap">
                                <asp:TextBox ID="TxtStartDate"  runat="server"   Width="150"></asp:TextBox>
                            </td>
                            <td class="tablefield">
                                结束时间:</td>
                            <td nowrap="nowrap">
                                <asp:TextBox ID="txtEndDate" runat="server"  class="default" Width="150" ></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="tablefield">
                                拜访模式:</td>
                            <td nowrap="nowrap">
                                <asp:DropDownList ID="ddlVisitMode" runat="server" Width="150"> 
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="ddlVisitMode"
                              runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
                            </td>
                            <td class="tablefield">
                                拜访内容:</td>
                            <td nowrap="nowrap" colspan="3">
                                
                                    <asp:TextBox runat="server" class="default" ID="txtVisitContent" Height="62px" 
                                        Width="90%"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="txtVisitContent"
                              runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="tablefield">
                                &nbsp;</td>
                            <td nowrap="nowrap">
                                &nbsp;&nbsp;</td>
                            <td class="tablefield">
                                &nbsp;</td>
                            <td class="tablefield" align="right">
                                <input id="txtHidOrg" type="hidden" runat="server" />
                                <input id="txtHidUsers" type="hidden" runat="server" />
                                &nbsp;</td>
                            <td class="tablefield" align="right">
                                &nbsp;</td>
                            <td class="tablefield" align="right">
                               
                                &nbsp; &nbsp; &nbsp; &nbsp; </td>
                        </tr>
                    </table>
                 
                   
                </td>
            </tr>
        </table><br />
        <table id="wsd_inputtable" style="width: 100%">
            <tr>
                <td width="100%" class="tabletitle">
                    操作选项
                </td>
            </tr>
            <tr>
                <td class="buttonarea" style="text-align: right;">
                    <asp:Button ID="btnSave" runat="server" class="wsd_button2" Text="保存" onclick="btnSave_Click" OnClientClick="return checkDate();"   CausesValidation="true"
                                     />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
